<!-- 人员、科室病区对照 -->
<template>
    <div style="height:100%;width:100%;position:relative;">
        <div class="pagetop">
            <div class="search-title">
                <table>
                    <tr>
                        <td>快速查找</td>
                        <td>
                            <el-input placeholder="人员过滤,支持工号 姓名,输入码" size="small" style="width:180px;" v-model="sel_strinput" ref="input_user"></el-input>
                        </td>
                        <td>
                            <el-radio-group v-model="rd_vsmode" border text-align="left">
                                <el-radio label="1">全部</el-radio>
                                <el-radio label="2">无对照</el-radio>
                                <el-radio label="3">单对照</el-radio>
                                <el-radio label="4">多对照</el-radio>
                            </el-radio-group>
                        </td>
                        <td colspan="20">
                        </td>
                        <td>
                            <el-switch v-model="sw_deptmode" active-text="按科室" inactive-text="按病区" style="width:150px;" border="1" @change="deptmode_change">
                            </el-switch>
                        </td>
                        <td>
                            <rm-ddl-common v-if="isshow" @change="deptchange" datatype="dept" dataname="科室" v-model="deptval" :appendtobody="true" width="200px"></rm-ddl-common>
                        </td>
                        <td>
                            <rm-ddl-common v-if="!isshow" @change="wardchange" datatype="ward" dataname="病区" v-model="wardval" width="200px"></rm-ddl-common>
                        </td>

                        <td colspan="4">
                        </td>
                        <td width="40px"></td>
                    </tr>
                </table>
            </div>
            <div class="top-deal">
                <td style="align:right">
                    <el-button @click="MainTable_Rfresh" icon="el-icon-search" v-has="'PINQUERY'" type="primary">查询</el-button>
                    <!--按照指定的查询条件查询用户列表-->
                    <el-button @click="sync_uservsdeptJudge" icon="el-icon-position">同步</el-button>
                    <!---同步当前查询到的用户对应科室病区, 同步前提示是否清除现有对照关系-->
                    <el-button @click="sync_uservsdeptbyuserno" icon="el-icon-refresh">同步当前</el-button>
                    <!--同步选择用户的对应科室, 对应病区, 同步前提示是否清除现有对照关系-->
                    <!--el-button @click="Mainsave" icon="el-icon-document">保存</el-button-->
                    <!--  保存y用户对照科室, 用户对照病区-->
                </td>
            </div>
            <div style="width:100%;">

            </div>
        </div>
        <div class="pagecenter">
            <div class="middle-center" style="height:100%;">
                <vxe-table :data.sync="list" :loading="MainLoading" :checkbox-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" ref="user_table" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow resizable show-overflow size="mini" stripe :row-class-name="MainTableRowClassName" @current-change="MainTableChange_Event" show-header-overflow :optimization="{animat: false}" header-align="center">
                    <vxe-table-column field="hospcode" align="center" sortable title="所属医院代码" width="150" v-if="false" show-overflow></vxe-table-column>
                    <vxe-table-column field="userkindname" align="center" sortable title="用户大类" width="120" show-overflow></vxe-table-column>
                    <vxe-table-column field="userno" align="center" sortable title="用户代号" width="120" show-overflow></vxe-table-column>
                    <vxe-table-column field="username" align="center" sortable title="用户名称" width="120" show-overflow></vxe-table-column>
                    <vxe-table-column field="hiscode1" align="center" sortable title="HIS系统对照1" width="150" show-overflow></vxe-table-column>
                    <vxe-table-column field="inputcode" align="center" sortable title="输入码" width="150" show-overflow></vxe-table-column>
                    <vxe-table-column field="enabled" align="center" sortable title="是否可用" width="80" show-overflow></vxe-table-column>
                </vxe-table>
            </div>
            <div class="middle-right">
                <el-tabs style="height:100%;" type="border-card" v-model="tab_active">
                    <el-tab-pane label="对照科室" name="tabname_dept">
                        <div style="height:40%">
                            <vxe-table :data.sync="DeptTabledata" :loading="Deptloading" :checkbox-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" style="height:100%" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="uservsdept" resizable row-id="vsdept_rowid" show-overflow size="mini" stripe @cell-dblclick="Dept_del" show-header-overflow :optimization="{animat: false}">
                                <vxe-table-column field="deptno" sortable title="代码" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="deptname" sortable title="科室名称" width="200" show-overflow></vxe-table-column>
                            </vxe-table>
                        </div>
                        <table style="height:36px">
                            <tr>
                                <td style="width:70px">快速检索</td>
                                <td></td>
                                <td style="width:320px">
                                    <el-input placeholder="科室快速检索,双击下方数据添加, 双击上方数据删除" v-model="input_dept" clearable @input="Deptlist_change" ref="dept_input" style="width:100%"> </el-input>
                                </td>
                                <td style="width:80px">
                                    <el-button @click="addAllDepartment" icon="el-icon-caret-top">对照全部科室</el-button>
                                </td>
                            </tr>
                        </table>
                        <div style="height:55%">
                            <vxe-table :data.sync="DeptTableAdata" :loading="DeptAloading" @cell-dblclick="Dept_Add" :checkbox-config="{reserve: true}" :sort-config="{trigger: 'cell'}" style="height:100%" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="deptlist" resizable row-id="Main_Table_rowid" show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" :row-class-name="rowClassName">
                                <vxe-table-column field="deptno" sortable title="代码" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="deptname" sortable title="科室名称" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="parentdeptname" sortable title="上级科室" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="inputcode" sortable title="输入码" width="120" show-overflow></vxe-table-column>
                            </vxe-table>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="对照病区" name="tabname_ward">
                        <div style="height:40%">
                            <vxe-table :data.sync="WardTabledata" :loading="WardLoading" :checkbox-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" style="height:100%" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="uservsward" resizable row-id="Main_Table_rowid" show-overflow size="mini" stripe @cell-dblclick="Ward_Del" show-header-overflow :optimization="{animat: false}">>
                                <vxe-table-column field="wardno" sortable title="代码" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="wardname" sortable title="病区名称" width="200" show-overflow></vxe-table-column>
                            </vxe-table>
                        </div>
                        <table style="height:36px">
                            <tr>
                                <td style="width:70px">快速检索</td>
                                <td style="width:320px">
                                    <el-input placeholder="病区快速检索,双击下方数据添加, 双击上方数据删除" v-model="input_ward" clearable @input="Wardlist_change" ref="ward_input" style="width:100%">> </el-input>
                                </td>
                                <td style="width:80px">
                                    <el-button @click="addAllWard" icon="el-icon-caret-top">对照全部病区</el-button>
                                </td>
                            </tr>
                        </table>
                        <div style="height:55%">
                            <vxe-table :data.sync="WardTableAdata" :loading="WardALoading" :checkbox-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" style="height:100%" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="wardlist" resizable row-id="Main_Table_rowid" show-overflow size="mini" stripe @cell-dblclick="Ward_Add" show-header-overflow :optimization="{animat: false}" :row-class-name="rowClassName">
                                <vxe-table-column field="wardno" sortable title="代码" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="wardname" sortable title="病区名称" width="120" show-overflow></vxe-table-column>
                                <vxe-table-column field="inputcode" sortable title="输入码" width="120" show-overflow></vxe-table-column>
                            </vxe-table>
                        </div>

                    </el-tab-pane>
                </el-tabs>
            </div>
        </div>
    </div>
</template>


<script>
import { Promise } from "q";
import { invalid } from "moment";
export default {
    name: "MNG118",
    data() {
        return {
            rd_vsmode: "1",
            MainLoading: false,
            WardLoading: false,
            WardALoading: false,
            Deptloading: false,
            DeptAloading: false,
            sw_deptmode: true,
            isshow: false,
            MainTableData: [],
            DeptTableAdata: [],
            DeptTabledata: [],
            WardTableAdata: [],
            WardTabledata: [],
            tempdeptData: [],
            tempwardData: [],
            tempuserData: [],
            input_dept: "",
            input_ward: "",
            sel_strinput: "",
            deptval: "",
            wardval: "",
            selwardval: "",
            selwardname: "",
            newwardval: "",
            seldeptval: "",
            seldeptname: "",
            newdeptval: "",
            ls_userno: "",
            tab_active: "tabname_dept", //根据用户类型自动切换 ,  医生对应科室, 护士对应病区
            // 科室列表需要动态生成,
            dictlist: [
                {
                    value: "0001",
                    label: "内科"
                },
                {
                    value: "0002",
                    label: "外科"
                }
            ],
            sel_deptno: ""
        };
    },
    created() {
        this.userlist_refresh();

        //.user_list.getdata();
    },
    tab_getdata() {},
    watch: {
        sel_strinput(val) {
            if (this.list.length > 0) {
                this.$nextTick(() => {
                    this.ls_userno = this.list[0].userno;
                    this.$refs.user_table.setCurrentRow(this.list[0]);
                    this.currentChangeEventFun();
                });
            }
        }
    },
    computed: {
        list() {
            let filterName = this.sel_strinput.trim();
            if (filterName) {
                let rest = this.MainTableData.filter(item => {
                    return item.userno.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || (item.username ? item.username.toUpperCase().indexOf(filterName.toUpperCase()) > -1 : false) || (item.inputcode ? item.inputcode.toUpperCase().indexOf(filterName.toUpperCase()) > -1 : false);
                });
                return rest;
            } else {
                return this.MainTableData;
            }
        }
    },
    mounted() {},
    updated() {
        //this.getButtonWidth();
    },
    methods: {
        // 检索用户信息
        userlist_refresh() {
            this.MainLoading = true;
            this.$tool
                .request({
                    url: "MNG/MNG1/MNG118",
                    method: "post",
                    data: {
                        action: "secsysuser_query",
                        rd_vsmode: this.rd_vsmode,
                        sw_deptmode: this.sw_deptmode,
                        wardval: this.wardval,
                        deptval: this.deptval
                    }
                })
                .then(res => {
                    this.MainTableData = res.Data;
                    this.MainLoading = false;
                    if (res.Data.length > 0) {
                        this.ls_userno = res.Data[0].userno;
                        this.$refs.user_table.setCurrentRow(res.Data[0]);
                        this.currentChangeEventFun();
                    } else {
                        this.DeptTableAdata = [];
                        this.DeptTabledata = [];
                        this.WardTableAdata = [];
                        this.WardTabledata = [];
                    }
                    this.tempuserData = res.Data; //this.$refs.user_table.getData();
                })
                .catch(e => {
                    this.$message.error(e);
                });
        },
        deptchange(code, name) {
            this.seldeptval = code;
            this.seldeptname = name;
        },
        wardchange(code, name) {
            this.seldwardtval = code;
            this.seldwardname = name;
        },

        Ward_Add({ row, rowIndex, column, columnIndex }, event) {
            //   console.log(row.deptname);
            if(row.invalidflag=="1"){
                this.$message({
                    message: row.wardname+"已作废，无法对照",
                    type: "warning"
                });
                return false;
            }
            var insertrow = {
                wardno: row.wardno,
                wardname: row.wardname
            };
            this.$refs.uservsward.insertAt(insertrow, -1);
            this.$refs.wardlist.remove(row);
            this.$tool
                .request({
                    url: "MNG/MNG1/MNG118",
                    method: "post",
                    data: {
                        action: "save_uservsdept",
                        userno: this.ls_userno,
                        deptno: row.wardno,
                        vstype: "2"
                    }
                })
                .then(response => {
                    if (response.errcode == "1") {
                        this.$message({
                            message: "保存对照病区成功",
                            type: "success"
                        });
                    } else {
                        this.$message({
                            message: "保存对照病区失败<br/><br/>详细信息：" + response.errmsg,
                            type: "warning"
                        });
                    }
                });
            // this.tempwardData = this.$refs.wardlist.getData();
            let frowindex = this.tempwardData.findIndex(t => t.wardno == row.wardno);
            if (frowindex >= 0) {
                this.tempwardData.splice(frowindex, 1);
            }
            this.$refs.ward_input.focus();

            //添加病区
        },
        Ward_Del({ row, rowIndex, column, columnIndex }, event) {
            //删除病区对照
            var insertrow = {
                wardno: row.wardno,
                wardname: row.wardname
            };

            this.$tool
                .request({
                    url: "MNG/MNG1/MNG118",
                    method: "post",
                    data: {
                        action: "del_uservsdept",
                        userno: this.ls_userno,
                        deptno: row.wardno,
                        vstype: "2"
                    }
                })
                .then(response => {
                    if (response.errcode == "1") {
                        this.$message({
                            message: "删除对照病区成功",
                            type: "success"
                        });
                        // this.tempwardData = this.$refs.wardlist.getData();
                        this.tempwardData.push(row);
                        this.$refs.wardlist.insertAt(insertrow, -1);
                        this.$refs.uservsward.remove(row);
                    } else {
                        this.$message({
                            message: "删除对照病区失败<br/><br/>详细信息：" + response.errmsg,
                            type: "warning"
                        });
                    }
                });
        },
        Dept_Add({ row, rowIndex, column, columnIndex }, event) {
            /// altert(row.deptno);
            if(row.invalidflag=="1"){
                this.$message({
                    message: row.deptname+"已作废，无法对照",
                    type: "warning"
                });
                return false;
            }
            console.log(row.deptname);
            var insertrow = {
                deptno: row.deptno,
                deptname: row.deptname
            };
            this.$refs.uservsdept.insertAt(insertrow, -1);
            this.$refs.deptlist.remove(row);
            // 直接保存对应关系
            //save_uservsdept
            this.$tool
                .request({
                    url: "MNG/MNG1/MNG118",
                    method: "post",
                    data: {
                        action: "save_uservsdept",
                        userno: this.ls_userno,
                        deptno: row.deptno,
                        vstype: "1"
                    }
                })
                .then(response => {
                    if (response.errcode == "1") {
                        this.$message({
                            message: "保存对照科室成功",
                            type: "success"
                        });
                        // this.tempdeptData = this.$refs.deptlist.getData();
                        let frowindex = this.tempdeptData.findIndex(t => t.deptno == row.deptno);
                        if (frowindex >= 0) {
                            this.tempdeptData.splice(frowindex, 1);
                        }
                    } else {
                        this.$message({
                            message: "保存对照科室成功<br/><br/>详细信息：" + response.errmsg,
                            type: "warning"
                        });
                    }
                });
            this.$refs.dept_input.focus();
            //添加科室对照
        },
        addAllDepartment(){
            //去除已作废的科室
            var deptList = this.DeptTableAdata.filter(t => t.invalidflag != '1');
            if(!!deptList && deptList.length > 0){
                var deptnos = '';
                deptList.forEach(element => {
                    deptnos += element.deptno + ',';
                });
                if(deptnos.endsWith(',')){
                    deptnos = deptnos.substring(0 , deptnos.length - 1);
                }
                //后台处理
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "save_uservsdept",
                            userno: this.ls_userno,
                            deptno: deptnos,
                            vstype: "1"
                        }
                    })
                    .then(response => {
                        if (response.errcode == "1") {
                            this.$message({
                                message: "保存对照科室成功",
                                type: "success"
                            });
                            deptList.forEach(e => {
                                var insertrow = {
                                    deptno: e.deptno,
                                    deptname: e.deptname
                                };
                                this.$refs.uservsdept.insertAt(insertrow, -1);
                                this.$refs.deptlist.remove(e);
                                let frowindex = this.tempdeptData.findIndex(t => t.deptno == e.deptno);
                                if (frowindex >= 0) {
                                    this.tempdeptData.splice(frowindex, 1);
                                }
                            });
                        } else {
                            this.$message({
                                message: "保存对照科室失败<br/><br/>详细信息：" + response.errmsg,
                                type: "warning"
                            });
                        }
                    });
            }
            this.$refs.dept_input.focus();
        },
        addAllWard(){
            //去除已作废的病区
            var wardList = this.WardTableAdata.filter(t => t.invalidflag != '1');
            if(!!wardList && wardList.length > 0){
                var wardnos = '';
                wardList.forEach(element => {
                    wardnos += element.wardno + ',';
                });
                if(wardnos.endsWith(',')){
                    wardnos = wardnos.substring(0 , wardnos.length - 1);
                }
                //后台处理
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "save_uservsdept",
                            userno: this.ls_userno,
                            deptno: wardnos,
                            vstype: "2"
                        }
                    })
                    .then(response => {
                        if (response.errcode == "1") {
                            this.$message({
                                message: "保存对照病区成功",
                                type: "success"
                            });
                            wardList.forEach(e => {
                                var insertrow = {
                                    wardno: e.wardno,
                                    wardname: e.wardname
                                };
                                this.$refs.uservsward.insertAt(insertrow, -1);
                                this.$refs.wardlist.remove(e);
                                let frowindex = this.tempwardData.findIndex(t => t.wardno == e.wardno);
                                if (frowindex >= 0) {
                                    this.tempwardData.splice(frowindex, 1);
                                }
                            });
                        } else {
                            this.$message({
                                message: "保存对照病区失败<br/><br/>详细信息：" + response.errmsg,
                                type: "warning"
                            });
                        }
                    });
            }
            this.$refs.ward_input.focus();
        },
        Dept_del({ row, rowIndex, column, columnIndex }, event) {
            //删除科室对照
            //删除病区对照
            var insertrow = {
                deptno: row.deptno,
                deptname: row.deptname
            };

            this.$tool
                .request({
                    url: "MNG/MNG1/MNG118",
                    method: "post",
                    data: {
                        action: "del_uservsdept",
                        userno: this.ls_userno,
                        deptno: row.deptno,
                        vstype: "1"
                    }
                })
                .then(response => {
                    if (response.errcode == "1") {
                        this.$message({
                            message: "删除对照科室成功",
                            type: "success"
                        });
                        this.tempdeptData.push(row);
                        this.$refs.deptlist.insertAt(insertrow, -1);
                        this.$refs.uservsdept.remove(row);
                    } else {
                        this.$message({
                            message: "删除对照科室失败<br/><br/>详细信息：" + response.errmsg,
                            type: "warning"
                        });
                    }
                });
        },
        MainTableRowClassName({ row, rowIndex }){
            if (row.enabled != "是") {
                return "rm-disable"; //禁用
            }
        },
        rowClassName({ row, rowIndex }){
            if (row.invalidflag == "1") {
                return "rm-alert";
            }
        },
        currentChangeEventFun() {
            //人员信息切换
            //需要保存前一个人的信息

            this.Deptloading = true;
            new Promise(resolve => {
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "getdeptlist_byuserno",
                            userno: this.ls_userno
                        }
                    })
                    .then(res => {
                        this.DeptTabledata = res.Data;
                        this.Deptloading = false;
                        resolve();
                    })
                    .catch(e => {
                        //console.log(e.message);
                        this.$message.error(e.message);
                    });
            });
            new Promise(resolve => {
                this.WardLoading = true;
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "getwardlist_byuserno",
                            userno: this.ls_userno
                        }
                    })
                    .then(res => {
                        this.WardTabledata = res.Data;
                        this.WardLoading = false;
                        resolve();
                    })
                    .catch(e => {
                        //console.log(e);
                        //this.$message.error(e.message);
                    });
            });
            this.wardlist_refresh();
            this.deptlist_refresh();
        },
        MainTableChange_Event({ row }) {
            this.ls_userno = row.userno;
            this.currentChangeEventFun();
        },
        MainTable_Rfresh() {
            // 按设定条件检索人员信息
            this.sel_strinput = "";
            this.userlist_refresh();
        },
        sync_uservsdeptJudge() {
            this.$confirm('同步前您要 <span style="color:red">清空所有原有对照</span> 吗？', "提示", {
                dangerouslyUseHTMLString: true,
                confirmButtonText: "清空原有对照后同步",
                cancelButtonText: "仅新增本次同步数据",
                focusCancelButton: true,
                closeOnClickModal: false,
                type: "warning",
                beforeClose: (action, instance, done) => {
                    if (action == "confirm") {
                        this.sync_uservsdept(1);
                        done();
                    } else if (action == "cancel") {
                        this.sync_uservsdept(2);
                        done();
                    } else if (action == "close") {
                        done();
                    }
                }
            }).catch(() => {
                this.$message("已取消同步数据！");
            });
        },
        sync_uservsdept(type) {
            //同步当前查询到的人员对照关系
            new Promise(resolve => {
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "uservsdept_sync",
                            hospcode: "",
                            synctype: type
                        }
                    })
                    .then(res => {
                        this.userlist_refresh(); //刷新用户字典
                        resolve();
                    })
                    .catch(e => {
                        this.userlist_refresh(); //刷新用户字典
                        this.$message.error(e.message);
                    });
            });
        },
        sync_uservsdeptbyuserno() {
            //同步选中人员的科室病区对照关系
            new Promise(resolve => {
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "uservsdept_syncbyuser",
                            hospcode: "",
                            userno: this.ls_userno
                        }
                    })
                    .then(res => {
                        this.currentChangeEventFun();
                        resolve();
                    })
                    .catch(e => {
                        this.currentChangeEventFun();
                        this.$message.error(e.message);
                    });
            });
            // MainTableChange_Event({ row, rowIndex, column, columnIndex }, event);
        },
        Deptlist_change() {
            let record = [];
            let record1 = [];
            //   this.console(record);
            record = this.tempdeptData;
            console.log("sss", record);
            let inputno = this.input_dept.trim();
            console.log("ddd", this.input_dept.trim());
            if (this.inputno != "") {
                record1 = record.filter(item => item.deptno.indexOf(inputno) > -1 || (item.deptname ? item.deptname.indexOf(inputno) > -1 : false) || (item.inputcode ? item.inputcode.toUpperCase().indexOf(inputno.toUpperCase()) > -1 : false));
            } else {
                record1 = record;
            }

            this.DeptTableAdata = record1;
            // 科室过滤
        },
        Wardlist_change() {
            // 病区过滤
            // this.console(this.ward_input.trim());
            let record = [];
            let record1 = [];
            record = this.tempwardData;
            console.log("sss", record);
            let inputno = this.input_ward.trim();
            if (this.inputno != "") {
                record1 = record.filter(item => item.wardno.indexOf(inputno) > -1 || item.wardname.indexOf(inputno) > -1 || (item.inputcode ? item.inputcode.toUpperCase().indexOf(inputno.toUpperCase()) > -1 : false));
            } else {
                record1 = record;
            }
            this.WardTableAdata = record1;
        },
        Mainsave() {
            // 保存对照关系
            //   var record1 = this.$refs.uservsdept.tableData;
            //   var record2 = this.$refs.uservsward.tableData;

            this.$tool
                .request({
                    url: "LIS/LIS1/LIS131",
                    method: "post",
                    data: {
                        action: "save",
                        userno: this.ls_userno
                    }
                })
                .then(res => {
                    if (res.errcode == 1) {
                        this.$message({
                            message: "保存成功",
                            type: "success"
                        });
                        this.LoadAll();
                    } else {
                        this.$message.error("保存失败:" + res.errmsg);
                    }
                })
                .catch(error => {
                    console.log(error.message);
                });

            ///  var userno  = this.$refs.userlist.row.userno;
        },

        deptlist_refresh() {
            new Promise(resolve => {
                this.DeptAloading = true;

                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "deptlist_query",
                            sel_strinput: this.input_dept,
                            userno: this.ls_userno,
                            hospcode: ""
                        }
                    })
                    .then(res => {
                        this.DeptTableAdata = res.Data;
                        this.DeptAloading = false;
                        this.tempdeptData = res.Data;
                        resolve();
                    })
                    .catch(e => {
                        this.$message.error(e.message);
                    });
            });
        },

        deptmode_change() {
            console.log("ssss");
            if (this.sw_deptmode == true) {
                this.isshow = false;
            } else {
                this.isshow = true;
            }
        },
        wardlist_refresh() {
            new Promise(resolve => {
                this.WardALoading = true;
                this.$tool
                    .request({
                        url: "MNG/MNG1/MNG118",
                        method: "post",
                        data: {
                            action: "wardlist_query",
                            input_ward: this.input_ward,
                            userno: this.ls_userno,
                            hospcode: ""
                        }
                    })
                    .then(res => {
                        this.WardTableAdata = res.Data;
                        this.WardALoading = false;
                        this.tempwardData = res.Data;
                        resolve();
                    })
                    .catch(e => {
                        this.$message.error(e.message);
                    });
            });
        }
    }
};
</script>

<style scoped>
::v-deep .vxe-body--row.row-stop {
    color: white !important;
    background-color: rgb(255, 192, 192) !important;
}
::v-deep .vxe-body--row.row-new {
    color: red !important;
}
::v-deep .vxe-body--row.row-green {
    background-color: #187 !important;
    color: #fff;
}
::v-deep .vxe-body--column.col-red {
    background-color: red;
    color: #fff;
}
::v-deep .el-input.is-disabled .el-input__inner {
    color: black;
}
::v-deep .el-checkbox.is-disabled .el-checkbox__label {
    color: black;
}
::v-deep .el-textarea.is-disabled .el-textarea__inner {
    color: black;
}

.pagetop {
    left: 0;
    right: 0;
    height: 66px;
    -webkit-box-pack: left;
    -webkit-box-align: center;
    border: solid 1px #ccc;
    position: absolute;
    z-index: 99;
}

.pagecenter {
    position: absolute;
    top: 70px;
    width: 100%;
    left: 0;
    bottom: 0px;
    overflow: auto;
}

.middle-center {
    position: absolute;
    height: 100%;
    right: 575px;
    left: 0;
    overflow: auto;
}

.middle-right {
    background-color: chartreuse;
    position: absolute;
    top: 0;
    bottom: 0px;
    overflow: visible;
    width: 570px;
    right: 0px;
}
.search-title {
    margin: 0 5px 0px 4px;
    top: 0px;
    font-size: 12px;
}
.top-deal {
    right: 5px;
    position: absolute;
    top: 35px;
    display: flex;
    align-items: center;
}
table tr td:nth-child(odd) {
    text-align: right;
    white-space: nowrap;
}
table tr td:nth-child(even) {
    text-align: left;
}
table tr td:nth-child(1) {
    width: 80px;
}
table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 5px;
}
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.avatar-uploader .el-upload:hover {
    border-color: #409eff;
}
.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
}
.avatar {
    width: 178px;
    height: 178px;
    display: block;
}

.avatar-uploader-icon1 {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 50px;
    line-height: 50px;
    text-align: center;
}
.avatar1 {
    width: 178px;
    height: 50px;
    display: block;
}
</style>